package org.example.util;

import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.UUID;

/*
szy

*/
@Component
public class OrderNumber {
    public String orderNumber(int i){
        LocalDateTime dateTime=LocalDateTime.now();
        DateTimeFormatter formatter=DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
        String outTradeNo = formatter.format(dateTime);
        outTradeNo += ""+i+(int)(Math.random()*899+100);
        System.out.println(outTradeNo);
        return outTradeNo;
    }
    public String orderId(){
//        String  uuid = UUID.randomUUID().toString();
        UUID uuid = UUID.randomUUID();
        //去除“-”和空格
        return uuid.toString().replace("-", "").substring(5);

    }
}
